import request from '@/utils/request'

// 查询排产管理列表
export function listPlanning(query) {
  return request({
    url: '/prodplan/planning/list',
    method: 'get',
    params: query
  })
}

// 查询排产管理详细
export function getPlanning(planningId) {
  return request({
    url: '/prodplan/planning/' + planningId,
    method: 'get'
  })
}

// 新增排产管理
export function addPlanning(data) {
  return request({
    url: '/prodplan/planning',
    method: 'post',
    data: data
  })
}

// 修改排产管理
export function updatePlanning(data) {
  return request({
    url: '/prodplan/planning',
    method: 'put',
    data: data
  })
}

// 删除排产管理
export function delPlanning(planningId) {
  return request({
    url: '/prodplan/planning/' + planningId,
    method: 'delete'
  })
}

// 导出排产管理
export function exportPlanning(query) {
  return request({
    url: '/prodplan/planning/export',
    method: 'get',
    params: query
  })
}
// 拆分
export function split(data) {
  return request({
    url: '/prodplan/planning/split',
    method: 'post',
    data: data
  })
}
// 锁定
export function locked(planningId) {
  return request({
    url: '/prodplan/planning/locked/'+planningId,
    method: 'post',
  })
}
// 反锁定
export function unLocked(planningId) {
  return request({
    url: '/prodplan/planning/unlocked/'+planningId,
    method: 'post',
  })
}
// 派工
export function dispatch(data) {
  return request({
    url: '/prodplan/planning/dispatch/',
    method: 'post',
    data: data
  })
}
// 反派工
export function unDispatch(planningId) {
  return request({
    url: '/prodplan/planning/undispatch/'+planningId,
    method: 'post',
  })
}